#ifndef __BOUNDINGBOX_H__
#define __BOUNDINGBOX_H__

#include <SFML/Graphics.hpp>
#include <Metgine/Core/Vector2.h>

namespace Metgine
{

namespace Core
{
// Metgine/Core/BoundingBox.h
//
// Copyright 2011 Phillip Stephens
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
// Linking this library statically or dynamically with other modules is
// making a combined work based on this library.  Thus, the terms and
// conditions of the GNU General Public License cover the whole
// combination.

template <class T>
class METGINE_API BoundingBox
{
    public:
        BoundingBox();
        BoundingBox(const Vector2<T>& center, const Vector2<T>& halfSize);

        // Gets the minimum of the box
        Vector2<T> GetMin() const;

        // Gets the maximum of the box
        Vector2<T> GetMax() const;

        // Returns true if the box contains a given point
        bool Contains(const Vector2<T>& point) const;
        bool Contains(T x, T y) const;

        // Gets an expanded bounding box
        BoundingBox Expand(T x, T y) const;

        // Gets the center of the box
        Vector2<T>& GetCenter() const;
        void SetCenter(const Vector2<T>& center);
        // Gets the width of the box
        T GetWidth() const;

        // Gets the height of the box
        T GetHeight () const;

        Vector2<T> Center;
        Vector2<T> Extents;
};

typedef BoundingBox<float> BoundingBoxf;
typedef BoundingBox<int>   BoundingBoxi;

#include <Metgine/Core/BoundingBox.inl>

}; // Core
}; // Metgine

#endif // BOUNDINGBOX_H
